[POWERPC] add support for builtin command line
authorAmos Waterland <apw@us.ibm.com>
Mon, 7 Aug 2006 22:16:18 +0000 (17:16 -0500)
committerAmos Waterland <apw@us.ibm.com>
Mon, 7 Aug 2006 22:16:18 +0000 (17:16 -0500)
Support expressing Xen command line arguments at make invocation.  Use
same section name as Linux's zImage and reserve a certain amount of
space so that arguments can be manipulated by external tools.

Signed-off-by: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
xen/arch/powerpc/Makefile
xen/arch/powerpc/boot_of.c

index 2634acbdf6462267e9e9fdcea81a3174354030c4..7a44f65c25304b47e6ede374a3848b7464623dce 100644 (file)
@@ -83,6 +83,9 @@ physdev.o: ../x86/physdev.c
 
 HDRS += $(wildcard *.h)
 
+CMDLINE = "xen"
+boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
+
 start.o: boot/start.S
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
 
index 4fd5b0b5715a19b9f5503daa56652ae779ea4b3d..a450b7de9a2e18ef55204e5a521a9155d96aa5f6 100644 (file)
@@ -37,6 +37,10 @@ static int of_out;
 static ofdn_t boot_cpu;
 static char bootargs[256];
 
+#define COMMAND_LINE_SIZE 512
+static char builtin_cmdline[COMMAND_LINE_SIZE]
+    __attribute__((section("__builtin_cmdline"))) = CMDLINE;
+
 extern struct ns16550_defaults ns16550;
 
 #undef OF_DEBUG
@@ -449,8 +453,8 @@ static void boot_of_bootargs(multiboot_info_t *mbi)
     int rc;
 
     rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs));
-    if (rc == OF_FAILURE) {
-        strcpy(bootargs, "xen");
+    if (rc == OF_FAILURE || bootargs[0] == '\0') {
+        strlcpy(bootargs, builtin_cmdline, sizeof(bootargs));
     }
 
     mbi->flags |= MBI_CMDLINE;